package com.example.demo.config;

/**
 * @ClassName: Knife4jConfiguration
 * @Author : sz
 * @Date :2024/2/29  10:49
 * @Description: Knife4jConfiguration
 * @Version :1.0
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration(
        proxyBeanMethods = false
)
@EnableSwagger2
@Import({BeanValidatorPluginsConfiguration.class})
public class Knife4jConfiguration {
    public Knife4jConfiguration() {
    }

    @Bean({"defaultApi2"})
    public Docket defaultApi2() {
        return (new Docket(DocumentationType.SWAGGER_2))
                .apiInfo((new ApiInfoBuilder())
                        .title("石河子大学 APIs")
                        .description("石河子大学 APIs").
                        termsOfServiceUrl("https://www.simright.com/")
                        .version("1.0.0").build()).groupName("服务").select().apis(RequestHandlerSelectors.basePackage("com.example")).paths(PathSelectors.any()).build();
    }
}
